package com.fish.anne.model;

import com.fish.anne.model.BaseObject;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import java.io.Serializable;

@Entity
@Table(name="member_attr" )
public class MemberAttr extends BaseObject implements Serializable {
    private Long attrId;
    private String attrName;
    private String attrType;
    private boolean attrRequired;
    private String attrOption;
    private String attrValtype;
    private String attrTyname;
    private String attrGroup;
    private boolean showOn;
    private short showOrder;

    @Id   @GeneratedValue(strategy = GenerationType.AUTO)    
    public Long getAttrId() {
        return this.attrId;
    }
    
    public void setAttrId(Long attrId) {
        this.attrId = attrId;
    }
    
    @Column(name="attr_name", nullable=false, length=20)
    public String getAttrName() {
        return this.attrName;
    }
    
    public void setAttrName(String attrName) {
        this.attrName = attrName;
    }
    
    @Column(name="attr_type", nullable=false, length=20)
    public String getAttrType() {
        return this.attrType;
    }
    
    public void setAttrType(String attrType) {
        this.attrType = attrType;
    }
    
    @Column(name="attr_required", nullable=false)
    public boolean isAttrRequired() {
        return this.attrRequired;
    }
    
    public void setAttrRequired(boolean attrRequired) {
        this.attrRequired = attrRequired;
    }
    
    @Column(name="attr_option", nullable=false, length=65535)
    public String getAttrOption() {
        return this.attrOption;
    }
    
    public void setAttrOption(String attrOption) {
        this.attrOption = attrOption;
    }
    
    @Column(name="attr_valtype", nullable=false, length=20)
    public String getAttrValtype() {
        return this.attrValtype;
    }
    
    public void setAttrValtype(String attrValtype) {
        this.attrValtype = attrValtype;
    }
    
    @Column(name="attr_tyname", nullable=false, length=20)
    public String getAttrTyname() {
        return this.attrTyname;
    }
    
    public void setAttrTyname(String attrTyname) {
        this.attrTyname = attrTyname;
    }
    
    @Column(name="attr_group", nullable=false, length=20)
    public String getAttrGroup() {
        return this.attrGroup;
    }
    
    public void setAttrGroup(String attrGroup) {
        this.attrGroup = attrGroup;
    }
    
    @Column(name="show_on", nullable=false)
    public boolean isShowOn() {
        return this.showOn;
    }
    
    public void setShowOn(boolean showOn) {
        this.showOn = showOn;
    }
    
    @Column(name="show_order", nullable=false)
    public short getShowOrder() {
        return this.showOrder;
    }
    
    public void setShowOrder(short showOrder) {
        this.showOrder = showOrder;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MemberAttr pojo = (MemberAttr) o;

        if (attrName != null ? !attrName.equals(pojo.attrName) : pojo.attrName != null) return false;
        if (attrType != null ? !attrType.equals(pojo.attrType) : pojo.attrType != null) return false;
        if (attrRequired != pojo.attrRequired) return false;
        if (attrOption != null ? !attrOption.equals(pojo.attrOption) : pojo.attrOption != null) return false;
        if (attrValtype != null ? !attrValtype.equals(pojo.attrValtype) : pojo.attrValtype != null) return false;
        if (attrTyname != null ? !attrTyname.equals(pojo.attrTyname) : pojo.attrTyname != null) return false;
        if (attrGroup != null ? !attrGroup.equals(pojo.attrGroup) : pojo.attrGroup != null) return false;
        if (showOn != pojo.showOn) return false;
 
        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (attrName != null ? attrName.hashCode() : 0);
        result = 31 * result + (attrType != null ? attrType.hashCode() : 0);
        result = 31 * result + (attrRequired ? 1 : 0);
        result = 31 * result + (attrOption != null ? attrOption.hashCode() : 0);
        result = 31 * result + (attrValtype != null ? attrValtype.hashCode() : 0);
        result = 31 * result + (attrTyname != null ? attrTyname.hashCode() : 0);
        result = 31 * result + (attrGroup != null ? attrGroup.hashCode() : 0);
        result = 31 * result + (showOn ? 1 : 0);
 
        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("attrId").append("='").append(getAttrId()).append("', ");
        sb.append("attrName").append("='").append(getAttrName()).append("', ");
        sb.append("attrType").append("='").append(getAttrType()).append("', ");
        sb.append("attrRequired").append("='").append(isAttrRequired()).append("', ");
        sb.append("attrOption").append("='").append(getAttrOption()).append("', ");
        sb.append("attrValtype").append("='").append(getAttrValtype()).append("', ");
        sb.append("attrTyname").append("='").append(getAttrTyname()).append("', ");
        sb.append("attrGroup").append("='").append(getAttrGroup()).append("', ");
        sb.append("showOn").append("='").append(isShowOn()).append("', ");
        sb.append("showOrder").append("='").append(getShowOrder()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
